﻿using System.Xml;

namespace XamlLocalizer.Parsing
{
    public interface IReplacementStrategy
    {
        string Id { get; }

        string Name { get; }

        bool ExtractRootElementAttributesIntoElements { get; }

        string GetAttributeReplacementValue(ResourceKeyDesc keyDesc);

        XmlElement CreateReplacementElement(XmlDocument ownerDoc, ResourceKeyDesc keyDesc);

        void PrepareReplacement(XamlExtractor xamlExtractor, string resourcesNamespace, string resourceClass);
    }

    public class ResourceKeyDesc
    {
        public string Assembly;
        public string ResourceFile;
        public string ItemKey;

        public ResourceKeyDesc(string assembly, string resourceFile, string itemKey)
        {
            Assembly = assembly;
            ResourceFile = resourceFile;
            ItemKey = itemKey;
        }

        public ResourceKeyDesc(string fullKey)
        {
            var keyParts = fullKey.Split(':');
            Assembly = keyParts[0];
            ResourceFile = keyParts[1];
            ItemKey = keyParts[2];
        }
    }
}
